<?php

namespace VueRender\Schema;

use VueRender\Contracts\Support\Renderable;
use VueRender\Schema;

class VueRender extends Schema
{
    /**
     * @param string $filename
     */
    public function __construct(string $filename)
    {
        $this->componentName = "vue-render";
        $this->filename($filename);
    }

    /**
 * @param string $filename
 * @return $this
 */
    public function filename(string $filename):static
    {
        return $this->prop("filename", $filename);
    }

    /**
     * @param string $filepath
     * @return $this
     */
    public function filepath(string $filepath):static
    {
        return $this->prop("filepath", $filepath);
    }

    /**
     * @param string $apiPrefix
     * @return $this
     */
    public function apiPrefix(string $apiPrefix):static
    {
        return $this->prop("apiPrefix", $apiPrefix);
    }

    /**
     * @param bool $devMode
     * @return $this
     */
    public function devMode(bool $devMode = false):static
    {
        return $this->prop("devMode", $devMode);
    }


    /**
     * @param string|Renderable $preload
     * @return $this
     */
    public function preload(string|Renderable $preload = ""):static
    {
        return $this->prop("preload", $preload instanceof Renderable?$preload->render():$preload);
    }


    /**
     * @param array $asyncProps
     * @return $this
     */
    public function asyncProps(array $asyncProps):static
    {
        return $this->prop("asyncProps", $asyncProps);
    }

    /**
     * @param array $axiosConfig
     * @return $this
     */
    public function axiosConfig(array $axiosConfig):static
    {
        return $this->prop("axiosConfig", $axiosConfig);
    }

    /**
     * @param array<string,object> $modules
     * @return $this
     */
    public function modules(array $modules):static
    {
        return $this->prop("modules", $modules);
    }
}
